//
// Created by dyc on 25-1-4.
// 主要功能
//1、实现相机的参数初始化（以param类为接口从yaml文件获取参数）
//2、实现相机的抓图，并记录实际帧率

#pragma once

#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>

namespace hitcrt {
    class Camera {
    public:
        //初始化构造函数
        explicit Camera(const int id = 0, const int width = 640, const int height = 480, const double fps = 30, const int brightness = 10, const int contrast = 10,
               const int saturation = 40, const int autoExposure = 3, const int exposure = 300) : ID(id), Width(width), Height(height),
            FPS(fps), Brightness(brightness), Contrast(contrast), Saturation(saturation), Auto_Exposure(autoExposure),
            Exposure(exposure) {};

        ~Camera(){cap.release();};

        cv::Mat image;
        cv::VideoCapture cap;

        //设置参数
        void set(int id = 0, int width = 640, int height = 480, double FPS = 30, double Brightness = 10, double Contrast = 10,
                 double Saturation = 40, double Auto_Exposure = 3, double Exposure = 300);
        int open();


    private:
        int ID;
        int Width;
        int Height;
        double FPS;
        double Brightness;
        double Contrast;
        double Saturation;
        double Auto_Exposure;
        double Exposure;
        double actual_FPS;

    };
}
